<?php

namespace app\admin\controller;

use think\admin\Controller;
use think\admin\helper\QueryHelper;
use think\admin\model\SystemSites;
use think\exception\HttpResponseException;

/**
 * 站点配置
 * @class Sites
 * @package app\admin\controller
 */
class Sites extends Controller
{
    /**
     * 站点配置
     * @auth true
     * @menu true
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        SystemSites::mQuery()->layTable(function () {
            $this->title = '站点配置';
        }, static function (QueryHelper $query) {
  
        });
    }

    /**
     * 列表数据处理
     * @param array $data
     * @throws \Exception
     */
    protected function _index_page_filter(array &$data)
    {
        // foreach ($data as &$vo) try {
        //   $vo['type'] == 1 ? $vo['type'] = 'QB' : $vo['type'] = 'TR';
        //   $vo['is_skip_hash'] == 1 ? $vo['is_skip_hash'] = '跳过' : $vo['is_skip_hash'] = '不跳过';
        //   $vo['is_paused'] == 1 ? $vo['is_paused'] = '是' : $vo['is_paused'] = '否';
        // } catch (\Exception $exception) {
        //     $vo['geoip'] = $exception->getMessage();
        // }
    }

    /**
     * 删除站点
     * @auth true
     */
    public function remove()
    {
        SystemSites::mDelete();
    }

    /**
     * 编辑站点
     * @auth true
     */
    public function edit()
    {
        SystemSites::mForm('edit');
    }
    /**
     * 添加站点
     * @auth true
     */
    public function add()
    {
        SystemSites::mForm('add');
    }
}
